<?php
require 'db.php';
require 'function.php';
$category = new Manager($link);
if (isset($_POST['submit'])){
    $Id = $_POST['Id'];
    $name = $_POST['name'];    
    $query = $category->addCategory($Id,$name);
    if ($query){
        header("Location:m_category.php");
    }
    else{
        echo "<script>alert('添加失败！');</script>";
        echo "<script>history.go(-1);</script>";
        header("Location:m_category.php");
    }
    
}

require 'cadd.html';
?>